//路由
const koaRouter = require("@koa/router");

//前缀
const commentRouter = new koaRouter({ prefix: "/comment" });

const { create, reply, update, remove } = require("../controller/comment_controller");

const { verifyAuth, verifyPermission } = require("../middleware/auth.middleware");

//创建
commentRouter.post("/", verifyAuth, create);

// 回复评论
commentRouter.post("/reply/:commentId", verifyAuth, reply);

// 修改评论
commentRouter.patch("/:commentId", verifyAuth, verifyPermission, update);

// 删除评论
commentRouter.delete("/:commentId", verifyAuth, verifyPermission, remove);

module.exports = commentRouter;
